<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head th:replace="fragment :: head(~{::title})">
  <title>添加模块</title>
</head>

<body>

<!--导航-->
<nav th:replace="admin/admin-fragment :: menu(2)" >

</nav>

<div class="ui attached pointing menu">
  <div class="ui container">
    <div class="right menu">
      <a href="#" th:href="@{/admin/tags/input}" class="teal active item">发布</a>
      <a href="#" th:href="@{/admin/tags}" class="item">列表</a>
    </div>
  </div>
</div>

<!--中间内容-->
<div  class="m-container m-padded-tb-big">
  <div class="ui container">                         <!--如果没id，则进行新增，若有id，则进行更新-->
    <form action="#" th:object="${tag}" th:action="*{id}==null ? @{/admin/addTags} : @{/admin/tags/{id}(id=*{id})}" method="post" class="ui form">
      <input type="hidden" name="id" th:value="${tag.getId()}">
      <div class="required field">
        <div class="ui left labeled input">
          <label class="ui teal basic label" >名称</label>
          <input type="text" name="name"  th:value="${tag.getName()}" placeholder="请输入模块名称" >
        </div>
      </div>


      <div class="ui error message"></div> <!--显示错误信息-->

      <!--        <div class="ui negetive message" th:unless="${#strings.isEmpty(msg)}">-->
      <!--          <i class="close icon"></i>-->
      <!--          <div class="header">验证失败：</div>-->
      <!--          <p th:text="${msg}">对不起，操作失败！</p>-->
      <!--        </div>-->

      <div class="ui right aligned container">
        <button type="button" class="ui button" onclick="window.history.go(-1)" >返回</button>
        <button type="button" id="save-btn" class="ui secondary submit button">提交</button>
      </div>

    </form>
  </div>
</div>

<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<!--底部footer-->
<footer th:replace="fragment :: footer" >

</footer>



<script>

  $('.menu.toggle').click(function () {
    $('.m-item').toggleClass('m-mobile-hide');
  });

  $('.ui.dropdown').dropdown({
    on : 'hover'
  });

  $('.ui.form').form({
    fields : {
      title : {
        identifier: 'name',
        rules: [{
          type : 'empty',
          prompt: '请输入标签名称'
        }]
      }
    }
  });


</script>
</body>
</html>
